/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package my.flowmeter.mycomm;

/**
 *
 * @author vadim
 */
import java.util.*;
import java.lang.*;

public class FrameGPRMC extends FrameNMEA {
    public FrameGPRMC(String dataSource){super(dataSource);
   }
    
    public double getSpeed(){return Double.parseDouble(source[7])*1.852;}
    
    public double getLat(){double d=Integer.parseInt(source[3].substring(0, 2))+
                            Double.parseDouble(source[3].substring(2))/60;
                           return d;}
    
    public double getLon(){double d= Integer.parseInt(source[5].substring(0, 3))+
                            Double.parseDouble(source[5].substring(3))/60;
                          return d;}
    
    public String getTime(int offset){return 
                    (Integer.parseInt(source[1].substring(0, 2)) + offset) +":"+
                    source[1].substring(2, 4)+":"+
                    source[1].substring(4,6);}
    @Override
    public String toString(){return source.toString();
    }
}
